﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication1;

namespace znq
{
    public partial class ThresholdControl : Form
    {
        Form1 main;
        public ThresholdControl(Form1 m)
        {
            InitializeComponent();
            main = m;
            setAttribute();
        }

        //初始化属性值
        private void setAttribute()
        {
            numericUpDown1.Value = main.k1_threshold;
            numericUpDown2.Value = main.k2_threshold;
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            main.k1_threshold = int.Parse(numericUpDown1.Value.ToString());
            int period = main.comboBox1.SelectedIndex;
            if(period != 0)
                main.drawK1(period);
        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {
            main.k2_threshold = int.Parse(numericUpDown2.Value.ToString());
            int period = main.comboBox1.SelectedIndex;
            if (period != 0)
                main.drawK2(period);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
